
import React, { useContext, forwardRef } from 'react'
import CustomizeModal, { CustomizeModalButton, CustomizeModalContext } from "@common/presentational/CustomizeModal";
import { Row, Col } from "antd";
import { reEnrollEmployee } from '@sagas/employee'
import {useDispatch, useSelector} from "react-redux";
const ReEnrollContent = props => {
    const { hide, params } = useContext(CustomizeModalContext)
    const { id } = params
    const { callback } = props
    const dispatch = useDispatch()

    const submit = () => {
        dispatch(reEnrollEmployee({
            empId: id
        },()=>{
            callback && callback()
        }))
        hide()
    }

    return (
        <>
            <CustomizeModalButton
                onOk={submit}
                onCancel={hide}
            />
        </>
    )
}

export default forwardRef((props, ref) => (
    <CustomizeModal width={500} title="是否恢复任职？" ref={ref}>
        <ReEnrollContent {...props} />
    </CustomizeModal>
))
